package com.kaizeli.website.pojo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 项目类型枚举
 */
@Getter
@AllArgsConstructor
public enum ProjectTypeEnum {
    MANPOWER(1, "人力项目"),
    TURNKEY(2, "整包项目"),
    SUBCONTRACT(3, "分包项目");
    
    private final Integer code;
    private final String desc;
    
    /**
     * 根据代码获取描述
     */
    public static String getDescByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ProjectTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type.getDesc();
            }
        }
        return null;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static ProjectTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ProjectTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}

